package com.epam.facebook_client.processor;

import java.util.HashMap;
import java.util.Map;

import common.processor.IProcessor;

public class ProcessorFactory {

	private static ProcessorFactory instance = null;
	private Map<String, IProcessor> map;
	private ProcessorFactory() {
		map = new HashMap<String, IProcessor>(5);
	}
	
	public static synchronized ProcessorFactory getInstance(){
		if(instance == null){
			instance = new ProcessorFactory();
		}
		return instance;
	}

	public IProcessor getProcessor(String key) {
		return map.get(key);
	}
	
	public IProcessor addProcessor(String key, IProcessor processor){
		return map.put(key, processor);
	}
	
	public IProcessor deleteProcessor(String key){
		return map.remove(key);
	}
}
